package com.xyhuo.leetcode.november;

import java.util.List;

/**
 * 统计和小于目标的下标队数目
 * https://leetcode.cn/problems/count-pairs-whose-sum-is-less-than-target
 *
 * @time 2023/11/24
 */
public class CountPairs {

    public int countPairs(List<Integer> nums, int target) {
        int length = nums.size();
        int result = 0;
        for (int i = 0; i < length; i++) {
            for (int j = i + 1; j < length; j++) {
                if (nums.get(i) + nums.get(j) < target) {
                    result++;
                }
            }
        }
        return result;
    }
}
